package cn.edu.scau.cmi.mazhixiang.adapter;

import javafx.application.Application;
import javafx.stage.Stage;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.TextArea;
public class AdapterClient extends Application {

	@FXML
    private Button OnpenPower;
	
    @FXML
    private Button ClowPower;

    @FXML
    private Button TransClass;

    @FXML
    private TextArea Textarea;

    @FXML
    private Button TransObject;
	@Override
	public void start(Stage primaryStage) throws Exception {
		Parent root = FXMLLoader.load(getClass().getResource("AdapterUI.fxml"));
		Scene scene = new Scene(root);
		primaryStage.setScene(scene);
		primaryStage.setResizable(false);
		primaryStage.setTitle("Adapter");
		primaryStage.show();
	}

	@FXML
    void onpower() {
		Adaptee adaptee= new Adaptee();
		Textarea.setText(adaptee.op()+"\n");
	}
	
	@FXML
    void transclass() {
		Target classTarget=new AdapterOfClass();
		Textarea.appendText(classTarget.doTarget()+"\n");
    }
	
    @FXML
    void transobject() {
    	Target classTarget=new AdapterOfObject();
		Textarea.appendText(classTarget.doTarget()+"\n");
    }
    
    @FXML
    void closepower() {
    	Textarea.clear();
    }
	public static void main(String[] args) {
		launch(args);
	}
}
